<%--
The Community Project
Copyright Team1 Productions

Joshua Amick
Stephen Cunningham
Thema Davis
Tomika Dawson
Lucie DeCristifaro

This JSP is an implementation of the user interface for the Community Project.  Several
tag libraries and custom libraries are used.

All Rights reserved.
--%>

<%@ page %>
<%@ page contentType="text/html"%>
<%@ page pageEncoding="UTF-8"%>

<%-- jstl taglibs --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%-- struts taglibs --%>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
<%-- custom taglib by Josh --%>
<%@ taglib prefix="custom" tagdir="/WEB-INF/tags/custom" %>

<c:set var="basePath">
	${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}
</c:set>
<c:set var="servletPath">
	${pageContext.request.servletPath}
</c:set>

<base href="${basePath}/" />

<%-- page content --%>
<custom:frame>
	<div id="styleTitle">
		<c:choose>
			<c:when test="${not empty RESULT_USER}">
				Edit User
			</c:when>
			<c:otherwise>
				Create User
			</c:otherwise>
		</c:choose>	
	</div>
	</br>
	<c:set var="actionPath">
		/SaveUser
	</c:set>
	<c:if test="${not empty RESULT_USER}">
		<c:set var="actionPath">
			/SaveUser.do?rUserid=${RESULT_USER.keyId}
		</c:set>
	</c:if>
	<title>Create An Account<title/>
	<html:form action="/SaveUser.do?r=${RESULT_USER.keyId}" method="post" enctype="multipart/form-data">
		<div id="styleInfo">
			<c:if test="${not empty INFO}">
				${INFO}
			</c:if>
		</div>
		<div id="styleErrors">
			<c:if test="${not empty ERROR}">
				${ERROR}
			</c:if>
		</div>
		Username&nbsp;<html:text property="username" value="${RESULT_USER.username}"/><br/>
		<%--<c:if test="${empty RESULT_USER}">
			Password&nbsp;<html:password property="password1"/><br/>
			Confirm Password&nbsp;<html:password property="password2"/><br/>
		</c:if>--%>
		Email&nbsp;<html:text property="email" value="${RESULT_USER.email}"/><br/>
		
		Personal Information</br>
			First Name&nbsp;<html:text property="firstName" value="${RESULT_USER.profile.firstName}"/></br>
			Last Name&nbsp;<html:text property="lastName" value="${RESULT_USER.profile.lastName}"/></br>
			Address&nbsp;<html:text property="address1" value="${RESULT_USER.profile.address1}"/></br>	
			Address 2&nbsp;<html:text property="address2" value="${RESULT_USER.profile.address2}"/></br>
			City&nbsp;<html:text property="city" value="${RESULT_USER.profile.city}"/></br>
			
			State&nbsp;
			<html:select property="state" value="${RESULT_USER.profile.state}">
                <html:option value="State"/>
                <html:option value="Alabama"/>
                <html:option value="Alaska"/>
                <html:option value="Arizona"/>
                <html:option value="Arkansas"/>
                <html:option value="California"/>
                <html:option value="Colorado"/>
                <html:option value="Connecticut"/>
                <html:option value="Delaware"/>
                <html:option value="Florida"/>
                <html:option value="Georgia"/>
                <html:option value="Hawaii"/>
                <html:option value="Idaho"/>
                <html:option value="Illinois"/>
                <html:option value="Indiana"/>
                <html:option value="Iowa"/>
                <html:option value="Kansas"/>
                <html:option value="Kentucky"/>
                <html:option value="Louisiana"/>
                <html:option value="Maine"/>
                <html:option value="Maryland"/>
                <html:option value="Massachusetts"/>
                <html:option value="Michigan"/>
                <html:option value="Minnesota"/>
                <html:option value="Mississippi"/>
                <html:option value="Missouri"/>
                <html:option value="Montana"/>
                <html:option value="Nebraska"/>
                <html:option value="Nevada"/>
                <html:option value="New Hampshire"/>
                <html:option value="New Jersey"/> 
                <html:option value="New Mexico"/>
                <html:option value="New York"/>
                <html:option value="North Carolina"/>
                <html:option value="North Dakota"/>
                <html:option value="Ohio"/>
                <html:option value="Oklahoma"/>
                <html:option value="Oregon"/>
                <html:option value="Pennsylvania"/>
                <html:option value="Rhode Island"/>
                <html:option value="South Carolina"/>   
                <html:option value="South Dakota"/>
                <html:option value="Tennessee"/>
                <html:option value="Texas"/>
                <html:option value="Utah"/>
                <html:option value="Vermont"/>
                <html:option value="Virginia"/>
                <html:option value="Washington"/>
                <html:option value="West Virginia"/>
                <html:option value="Winsconsin"/>
                <html:option value="Wyoming"/>               
            </html:select></br>
						
			Zipcode&nbsp;<html:text property="zip" value="${RESULT_USER.profile.zip}"/></br>		
			Sec'd. Email&nbsp;<html:text property="secondaryEmail" value="${RESULT_USER.profile.secondaryEmail}"/></br>
			Phone&nbsp;<html:text property="phone" value="${RESULT_USER.profile.phone}"/></br>
	    
	    	</br>
			Professional Information</br>	
			Education&nbsp;<html:textarea property="education" rows="3" cols="28" value="${RESULT_USER.profile.education}"/></br>
			Major&nbsp;			
			<html:select property="major" value="${RESULT_USER.profile.major}">
		        <html:option value="Major"/>
		        <html:option value="Computer Science"/>
		        <html:option value="Computer Engineering"/>
		        <html:option value="Computer Information Systems"/>
		        <html:option value="Other"/>
		    </html:select></br>	
			Graduation Date&nbsp;			
			<html:select property="gradYear" value="${DATES.gradYear}">
                <html:option value="Year"/>
                <html:option value="2003"/>
                <html:option value="2004"/>
                <html:option value="2005"/>
                <html:option value="2006"/>
                <html:option value="2007"/>
                <html:option value="2008"/>
                <html:option value="2009"/>
                <html:option value="2010"/>
                <html:option value="2011"/>
                <html:option value="2012"/>
                <html:option value="2013"/>
                <html:option value="2014"/>
            </html:select>
			<html:select property="gradMonth" value="${DATES.gradMonth}">
                <html:option value="Month"/>
                <html:option value="01"/>
                <html:option value="02"/>
                <html:option value="03"/>
                <html:option value="04"/>
                <html:option value="05"/>
                <html:option value="06"/>
                <html:option value="07"/>
                <html:option value="08"/>
                <html:option value="09"/>
                <html:option value="10"/>
                <html:option value="11"/>
                <html:option value="12"/>
            </html:select>
			<html:select property="gradDay" value="${DATES.gradDay}">
                <html:option value="Day"/>
                <html:option value="01"/>
                <html:option value="02"/>
                <html:option value="03"/>
                <html:option value="04"/>
                <html:option value="05"/>
                <html:option value="06"/>
                <html:option value="07"/>
                <html:option value="08"/>
                <html:option value="09"/>
                <html:option value="10"/>
                <html:option value="11"/>
                <html:option value="12"/>
                <html:option value="13"/>
                <html:option value="14"/>
                <html:option value="15"/>
                <html:option value="16"/>
                <html:option value="17"/>
                <html:option value="18"/>
                <html:option value="19"/>
                <html:option value="20"/>
                <html:option value="21"/>
                <html:option value="22"/>
                <html:option value="23"/>
                <html:option value="24"/>
                <html:option value="25"/>
                <html:option value="26"/>
                <html:option value="27"/>
                <html:option value="28"/>
                <html:option value="29"/>
                <html:option value="30"/>
                <html:option value="31"/>
            </html:select></br>
			Employer&nbsp;<html:text property="employer" value="${RESULT_USER.profile.employer}"/></br>
			Employment Start Date&nbsp;
						
			<html:select property="empStartYear" value="${DATES.empStartYear}">
                <html:option value="Year"/>
                <html:option value="2003"/>
                <html:option value="2004"/>
                <html:option value="2005"/>
                <html:option value="2006"/>
                <html:option value="2007"/>
                <html:option value="2008"/>
                <html:option value="2009"/>
                <html:option value="2010"/>
                <html:option value="2011"/>
                <html:option value="2012"/>
                <html:option value="2013"/>
                <html:option value="2014"/>
            </html:select>
			<html:select property="empStartMonth" value="${DATES.empStartMonth}">
                <html:option value="Month"/>
                <html:option value="01"/>
                <html:option value="02"/>
                <html:option value="03"/>
                <html:option value="04"/>
                <html:option value="05"/>
                <html:option value="06"/>
                <html:option value="07"/>
                <html:option value="08"/>
                <html:option value="09"/>
                <html:option value="10"/>
                <html:option value="11"/>
                <html:option value="12"/>
            </html:select>
			<html:select property="empStartDay" value="${DATES.empStartDay}">
                <html:option value="Day"/>
                <html:option value="01"/>
                <html:option value="02"/>
                <html:option value="03"/>
                <html:option value="04"/>
                <html:option value="05"/>
                <html:option value="06"/>
                <html:option value="07"/>
                <html:option value="08"/>
                <html:option value="09"/>
                <html:option value="10"/>
                <html:option value="11"/>
                <html:option value="12"/>
                <html:option value="13"/>
                <html:option value="14"/>
                <html:option value="15"/>
                <html:option value="16"/>
                <html:option value="17"/>
                <html:option value="18"/>
                <html:option value="19"/>
                <html:option value="20"/>
                <html:option value="21"/>
                <html:option value="22"/>
                <html:option value="23"/>
                <html:option value="24"/>
                <html:option value="25"/>
                <html:option value="26"/>
                <html:option value="27"/>
                <html:option value="28"/>
                <html:option value="29"/>
                <html:option value="30"/>
                <html:option value="31"/>
            </html:select></br></br>
			Position&nbsp;<html:text property="positionDescription" value="${RESULT_USER.profile.positionDescription}"/></br>
			Professional Organizations: (LIST)</br><html:textarea property="professionalOrganizations" rows="3" cols="28" value="${RESULT_USER.profile.professionalOrganizations}"/></br>
			Student Organizations: (LIST)</br><html:textarea property="studentOrganizations" rows="3" cols="28" value="${RESULT_USER.profile.studentOrganizations}"/></br>
		         
		    </br>   
			Options</br>
			<c:choose>
				<c:when test="${RESULT_USER.profile.publicViewable=='true'}">
					<input type=checkbox name="publicViewable" value="true"  checked="yes"/>
				</c:when>
				<c:otherwise>
					<input type=checkbox name="publicViewable" value="true"/>
				</c:otherwise>
			</c:choose>		
			Make my profile publicly viewable&nbsp;</br> 
			
			<c:choose>
				<c:when test="${RESULT_USER.subscribedToEmails=='true'}">
					<input type=checkbox name="subscribedToEmails" value="true"  checked="yes"/>
				</c:when>
				<c:otherwise>
					<input type=checkbox name="subscribedToEmails" value="true"/>
				</c:otherwise>
			</c:choose>
			Subscribe to auto emails and newsletters&nbsp;</br>	
			
			<c:choose>
				<c:when test="${AUTH_USER.username!=RESULT_USER.username}">
					<c:choose>
						<c:when test="${RESULT_USER.userPermissions=='ADMIN'}">
							<input type=checkbox name="isAdminUser" value="true"  checked="yes"/>
						</c:when>
						<c:otherwise>
							<input type=checkbox name="isAdminUser" value="true"/>
						</c:otherwise>
					</c:choose>			
					Grant or take away this user's admin rights&nbsp;</br>
				</c:when>
			</c:choose>
		    <html:submit value="&nbsp;Submit&nbsp;"/>
	</html:form>
</custom:frame>